package com.ita.compeople.impl;

import java.rmi.RemoteException;

import com.ita.command.Command;
import com.ita.dao.DepartmentDao;
import com.ita.dao.PeopleDao;
import com.ita.po.People;
import com.ita.po.ReturnValue;

public class CmdAddPeople implements Command {
	
	private PeopleDao peopleDao;
	private People people;

	
	public CmdAddPeople(PeopleDao peopleDao,People people) {
		super();
		this.peopleDao = peopleDao;
		this.people = people;
	}


	@Override
	public ReturnValue execute() throws RemoteException {
		Integer count = peopleDao.addPeople(people);
		if(count == 1)
			System.out.println("Add Success!");
		ReturnValue returnValue = new ReturnValue();
		returnValue.setCount(count);
		return returnValue;
	}

}
